﻿using System;
using Mapack;

namespace QProg
{
	public static class Generator
	{
		public static Matrix Generate(out int size, int k, int n)
		{

			var r = new Random();
			var a = new Matrix(k, n);
			for (var i = 0; i < k; i++)
				for (var j = 0; j < n; j++)
				{
					a[i, j] = r.Next(-6, 6);
				}
			size = n;

			return a.Transpose() * a;

		}

		public static Matrix GenerateC(int size)
		{
			var r = new Random();
			var c = new Matrix(size, 1);
			for (var i = 0; i < size; i++)
			{
				c[i, 0] = r.Next(-10, 10);
			}
			return c;
		}

		public static Matrix GenerateA(int m, int n)
		{
			var r = new Random();
			var a = new Matrix(m, n);
			for (var i = 0; i < m; i++)
				for (var j = 0; j < n; j++)
				{
					a[i, j] = r.Next(-6, 6);
				}
			return a;
		}

		public static Matrix GenerateB (int size)
		{
			var b = new Matrix(size,1);
			var r = new Random();
			for (var i=0; i<size;i++)
			{
				b[i, 0] = r.Next(-100, 100);
			}
			return b;
		}

		public static double[] GenerateDmin (int n, int minValue)
		{
			var dmin = new double[n];
			var r = new Random();
			for (int i=0; i<n; i++)
			{
				dmin[i] = -10;
				//dmin[i] = r.Next(minValue, 0);
			}
			return dmin;
		}

		public static double[] GenerateDmax(int n, int maxValue)
		{
			var dmax = new double[n];
			var r = new Random();
			for (int i = 0; i < n; i++)
			{
				dmax[i] = 10;
				//dmax[i] = r.Next(maxValue, 0);
			}
			return dmax;
		}
		
	}
}
